package com.mixsmart.web.tag.enums;

/**
 * 自定义按钮类型，常量定义
 * @author lmq <br />
 * 2016年8月2日
 * @version 1.0
 * @since JDK1.6
 */
public interface BtnPropType {

	/**
	 * 选择类型
	 * @author lmq <br />
	 * 2016年8月2日
	 * @version 1.0
	 * @since JDK1.6
	 */
	enum SelectType {
		/**
		 * 1 -- 不选择数据
		 */
		NONE(1,"none-selected"),
		/**
		 * 2 -- 只能选择一条数据
		 */
		ONE(2,"one-selected"),
		/**
		 * 3 -- 选择多条数据
		 */
		MULTI(3,"multi-selected");
		
		private int index;
		private String value;
		
		private SelectType(int index,String value) {
			this.index = index;
			this.value = value;
		}
		
		/**
		 * 获取选择类型对象
		 * @param index
		 * @return
		 */
		public static SelectType getObj(int index) {
			SelectType selectType = null;
			for (SelectType selectTypeTmp : SelectType.values()) {
				if(selectTypeTmp.getIndex() == index) {
					selectType = selectTypeTmp;
					break;
				}
			}
			return selectType;
		}
		
		/**
		 * 获取选择类型对象
		 * @param value
		 * @return
		 */
		public static SelectType getObj(String value) {
			SelectType selectType = null;
			for (SelectType selectTypeTmp : SelectType.values()) {
				if(selectTypeTmp.getValue().equals(value)) {
					selectType = selectTypeTmp;
					break;
				}
			}
			return selectType;
		}
		
		public int getIndex() {
			return index;
		}
		public void setIndex(int index) {
			this.index = index;
		}
		public String getValue() {
			return value;
		}
		public void setValue(String value) {
			this.value = value;
		}
	}
	
	/**
	 * 打开方式
	 * @author lmq <br />
	 * 2016年8月2日
	 * @version 1.0
	 * @since JDK1.6
	 */
	enum OpenStyle {
		/**
		 * 1 -- 弹出框
		 */
		OPEN_POP(1,"open-pop"),
		/**
		 * 2 -- 在当前所在页面打开
		 */
		OPEN_SELF(2,"open-self"),
		/**
		 * 3 -- 打开一个新的窗口
		 */
		OPEN_BLANK(3,"open-blank");
		
		private int index;
		private String value;
		
		private OpenStyle(int index,String value) {
			this.index = index;
			this.value = value;
		}
		
		/**
		 * 获取打开方式对象
		 * @param index
		 * @return
		 */
		public static OpenStyle getObj(int index) {
			OpenStyle openStyle = null;
			for (OpenStyle openStyleTmp : OpenStyle.values()) {
				if(openStyleTmp.getIndex() == index) {
					openStyle = openStyleTmp;
					break;
				}
			}
			return openStyle;
		}
		
		/**
		 * 获取打开方式对象
		 * @param value
		 * @return
		 */
		public static OpenStyle getObj(String value) {
			OpenStyle openStyle = null;
			for (OpenStyle openStyleTmp : OpenStyle.values()) {
				if(openStyleTmp.getValue().equals(value)) {
					openStyle = openStyleTmp;
					break;
				}
			}
			return openStyle;
		}
		
		public int getIndex() {
			return index;
		}
		public void setIndex(int index) {
			this.index = index;
		}
		public String getValue() {
			return value;
		}
		public void setValue(String value) {
			this.value = value;
		}
	}
	
}
